// const rp = require('request-promise')
// const axios = require('axios')
const sc_DBBASE = require('../models/sc_version')

const rp = require('request-promise')
var config = require("../utils/config");
// var intf = require("../utils/interface");
const db = require('../db')
const {
	Op
} = require("sequelize");
module.exports = function(router) {
	
	
	router.get('/sc/version/query', async (ctx) => {
		var {
			id
		} = ctx.query;
	
		//查询数据库是否存在
		let res = await sc_DBBASE.findOne({
			attributes: {
				//排除之前没有字段
				exclude: ['id', 'createdAt', 'updatedAt']
			},
			where: {
				_id: id
			},
		})
		// 如果存在,直接返回
		if (res) {
			ctx.rest(res)
		} else {
			//不存在就请求api，再存入数据库返回
			
		}
	})
	
	return router;
}
